package engine.parsers.impl;

import engine.content.IContent;
import engine.parsers.IParser;
import engine.services.IContentService;


public class CalvinHobbesParser implements IParser {


	// returns the url for the picture after parsing the original url
	public IContent parse(IContent urlContent, IContentService contentService) throws Exception {
		String urlContentStr = urlContent.getContent().toString();
		String gif = "http://images.ucomics.com/comics/ch/";
		// this is the actual parsing to get the url for the FS gif
		int i = urlContentStr.indexOf(gif) + gif.length();
		while(!urlContentStr.substring(i, i+1).equals("\"")) {
			gif += urlContentStr.substring(i, i+1);
			i++;
		}


		return contentService.getResponse(gif);
	}
}